<?php
namespace Plu\Library\Services\Utility;

use Plu\Library\Services\ServiceBase;

class NumberService {
	public static function smartFormat($count, $limit = 100000, $rate = 1) {
		if ($count > $limit) {
			$count = round($count / $limit, $rate) . "万";
		}

		return $count;
	}

	/**
	 * check array is number?
	 */
	public static function toNumberList($ids) {
		$items = array();
		if (!is_array($ids)) {
			return $items;
		}

		for ($c = 0, $len = count($ids); $c < $len; $c++) {
			$id = $ids[$c];
			if ($id > 0) {
				$items[] = $id;
			}
		}

		return $items;
	}
}

?>
